package com.mlz.mlzmall.ui.activity.act.order;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.mlz.mlzmall.R;
import com.mlz.mlzmall.ui.activity.act.main.MainActivity;
import com.mlz.mlzmall.ui.activity.act.personal.IntegralActivity;
import com.mlz.mlzmall.ui.activity.act.personal.MyNewActivity;
/**
 * Created by jason.zhou on 2016/2/27.
 */
public class ExchangePaySuccess extends Activity {
    private Button btn_home_page;
    private Button btn_center_integration;
    Intent intent;
    int type;
    String title,content;

    TextView textView1,textView2,textView3;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.exchange_pay_success);
        intent = getIntent();
        type = intent.getIntExtra("type", 0);
        title = intent.getStringExtra("title");
        content = intent.getStringExtra("content");

        textView1 = (TextView)findViewById(R.id.title);
        textView2 = (TextView)findViewById(R.id.content);
        textView3 = (TextView)findViewById(R.id.fff);

        btn_home_page = (Button) findViewById(R.id.btn_home_page);//点击到首页特的按钮
        btn_center_integration = (Button) findViewById(R.id.btn_center_integration);//点击跳转到积分中心的按钮

        btn_home_page.setOnClickListener(onclicklistener);
        if (type == 55)
            btn_center_integration.setText("我的活动");
        btn_center_integration.setOnClickListener(onclicklistener);

        if(!"".equals(title) || !"".equals(content)){
            textView1.setText(title);
            textView2.setText(content);
            textView3.setText("");
        }


    }

    public View.OnClickListener onclicklistener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.btn_center_integration:
                    Intent intent1 = new Intent();
                    if (type == 55)
                        intent1.setClass(ExchangePaySuccess.this, MyNewActivity.class);
                    else
                        intent1.setClass(ExchangePaySuccess.this, IntegralActivity.class);
                    startActivity(intent1);
                    finish();
                    break;
                case R.id.btn_home_page:
                    Intent intent2 = new Intent();
                    intent2.setClass(ExchangePaySuccess.this, MainActivity.class);
                    startActivity(intent2);
                    finish();
                    break;
                default:
                    break;
            }
        }
    };
}
